<!-- 辅导员成果奖励页面 -->
<template>
  <div class="app-container">
    <!-- 搜索 -->
    <searchForm
      :formOptions="formOptions"
      @onSearch="onSearch"
      @onReset="onReset"
      :formLabelWidth="formLabelWidth"
      v-show="showSearch"
    />
    <el-row :gutter="10" class="mb8">
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <el-table :data="roleList">
      <el-table-column label="姓名" prop="roleName" align="center" />
      <el-table-column label="单位" prop="roleName" align="center" />
      <el-table-column label="教工号" prop="roleKey" align="center" />
      <el-table-column label="获奖名称" prop="roleSort" align="center" />
      <el-table-column label="奖励类别" prop="roleSort" align="center" />
      <el-table-column label="作者位次" prop="roleSort" align="center" />
      <el-table-column label="奖励时间" prop="roleSort" align="center" />
      <el-table-column label="授予单位" prop="roleSort" align="center" />
      <el-table-column label="附件" prop="roleSort" align="center" />
      <el-table-column label="状态" prop="roleSort" align="center" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        width="220"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            style="margin-right: 10px"
            >查看</el-button
          >
          <el-popconfirm
            confirm-button-text="通过"
            cancel-button-text="驳回"
            icon="el-icon-info"
            icon-color="red"
            title="这是一段内容确定删除吗？"
          >
            <el-button slot="reference" size="mini" type="text">审核</el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 查看思源辅导员课堂研究 -->
    <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
      <el-form ref="form" :model="form" label-width="90px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="获奖名称">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="奖励类别">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="授予单位">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="获取级别">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="作者位次">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="奖励时间">
              <el-input v-model="form" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="附件" prop="roleName"> </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  listRole,
  getRole,
  delRole,
  addRole,
  updateRole,
  dataScope,
  changeRoleStatus,
  deptTreeSelect,
} from "@/api/system/role";
import {
  treeselect as menuTreeselect,
  roleMenuTreeselect,
} from "@/api/system/menu";
import searchForm from "@/components/Search/searchForm.vue";
export default {
  name: "Role",
  dicts: ["sys_normal_disable"],
  components: { searchForm },
  data() {
    return {
      formLabelWidth: "70px",
      formOptions: [
        {
          label: "姓名",
          prop: "GH",
          element: "el-input",
          placeholder: "请输入姓名",
        },
        {
          label: "单位",
          prop: "GH",
          element: "el-input",
          placeholder: "请输入单位",
        },
        {
          label: "教工号",
          prop: "GH",
          element: "el-input",
          placeholder: "请输入教工号",
        },
        {
          label: "奖励类别",
          prop: "GH",
          element: "el-input",
          placeholder: "请输入奖励类别",
        },
        {
          label: "获奖级别",
          prop: "type",
          element: "el-select",
          options: [],
          placeholder: "请选择获奖级别",
        },
        {
          label: "状态",
          prop: "type",
          element: "el-select",
          options: [
            { label: "待审核", value: "1" },
            { label: "通过", value: "2" },
            { label: "驳回", value: "3" },
          ],
          placeholder: "请选择状态",
        },
      ],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 角色表格数据
      roleList: [{ roleKey: "ceshi" }],
      // 弹出层标题
      title: "",
      // 上传辅导员信息数据
      uploadInfor: {},
      // 是否显示弹出层
      open: false,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
        roleKey: undefined,
        status: undefined,
      },
      // 表单参数
      form: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
        (response) => {
          this.roleList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    // 获取搜索表单提交的数据
    onSearch(val) {
      // 查询条件和分页数据合并
      const arr = Object.assign(this.queryParams, val);
      console.log(arr);
      this.queryParams.pageNum = 1;
      this.getList();
    },
// 重置
onReset(data) {
      console.log(data);
      this.queryParams.pageNum = 1;
      const arr = Object.assign(this.queryParams, data);
      console.log(this.queryParams);
      this.getList();
    },
    // 表单重置
    reset() {
      if (this.$refs.menu != undefined) {
        this.$refs.menu.setCheckedKeys([]);
      }
      this.form = {
        roleId: undefined,
        roleName: undefined,
        roleKey: undefined,
        roleSort: 0,
        status: "0",
        menuIds: [],
        deptIds: [],
        menuCheckStrictly: true,
        deptCheckStrictly: true,
        remark: undefined,
      };
      this.resetForm("form");
    },
    /** 查看按钮操作 */
    handleUpdate(row) {
      this.open = true;
      this.title = "查看思源辅导员文字成果奖";
    },
  },
};
</script>